package db_tool;

import org.apache.struts2.ServletActionContext;

import java.io.PrintWriter;
import java.sql.Statement;

public class Duser {
	private String ID;
	private PrintWriter writer = null;
	public String getID() {
		return ID;
	}
	public void setID(String ID) {
		this.ID = ID;
	}
    public String deleActive()throws Exception{
    	DBConnection db_connection = DBConnection.getInstance();
    	writer = ServletActionContext.getResponse().getWriter();
		Statement statement = null;
		statement = db_connection.getStatement();
		String sql="DELETE FROM RegisterAccount where RegID='" + ID+ "'";
		int n=0 ;
		//System.out.println(sql);
		try{
			n=statement.executeUpdate(sql);
			writer.write("success");
		}catch(Exception e){
			writer.write("error");
			e.printStackTrace();
		}
		if(n>0){
			db_connection.close(statement);
		}else{
			db_connection.close(statement);
		}
		return null;
    }
	
	
}
